<?php

use think\Facade\Route;
use think\Facade\Env;

Route::domain(Env::get('app.api_url'), function () {

    header("Access-Control-Allow-Origin: *");
    header('Access-Control-Allow-Methods: POST, PUT, GET, OPTIONS, DELETE, HEAD, PATCH');
    header("Access-Control-Allow-Headers: token,tokens,language, Origin, X-Requested-With, Content-Type, Accept");
    Route::miss(function () {
        echo '无访问权限';
        exit();
    });

    Route::group('User', function () {
        Route::get('mytest', '/mytest'); //用户登录
        Route::get('wechattest', '/wechattest'); //用户登录
        Route::post('Login', '/Login'); //用户登录
        Route::post('Login2', '/Login2'); //用户登录
        Route::post('Login3', '/Login3'); //用户登录
        Route::post('LoginTest', '/LoginTest'); //用户登录
        Route::post('Setmobile', '/Setmobile'); //用户登录
        Route::get('bindcode', '/bindcode'); //绑定邀请人
        Route::rule('address', '/address'); //用户登录
        Route::get('address_detail', '/address_detail'); //用户登录
        Route::get('address_del', '/address_del'); //用户登录
        Route::get('getstreet', '/getstreet'); //用户登录
        Route::get('garbagecate', '/garbagecate'); //用户登录
        Route::get('areaprice', '/areaprice'); //用户登录
        Route::get('getprice', '/getprice'); //用户登录
        Route::rule('order', '/order'); //用户登录
        Route::get('orderlist', '/orderlist'); //用户登录
        Route::get('ordercancel', '/ordercancel'); //用户登录
        Route::get('orderdetail', '/orderdetail'); //用户登录
        Route::rule('partnerApply', '/partnerApply'); //用户登录
        Route::get('info', '/info'); //申请代理信息
        Route::get('integral', '/integral'); //申请代理信息
        Route::rule('RiderApply', '/RiderApply'); //用户登录
        Route::rule('message', '/message'); //申请代理信息
        Route::rule('set_partner', '/set_partner'); //申请代理信息
        Route::rule('qrcode', '/qrcode'); //申请代理信息
        Route::get('invita', '/invita'); //申请代理信息
        Route::get('nearbyRider', '/nearbyRider'); //申请代理信息
    })->prefix('User');

    Route::group('Other', function () {
        Route::get('Annou', '/Annou'); //用户登录
        Route::get('Annous', '/Annous'); //用户登录
        Route::get('Banner', '/Banner'); //用户登录
        Route::get('News', '/News'); //用户登录
        Route::get('Newsdetail', '/Newsdetail'); //用户登录
        Route::post('sendMns', '/sendMns'); //用户登录
        Route::rule('uploads', '/uploads'); //用户登录
        Route::rule('geocoder', '/geocoder'); //用户登录
        Route::get('appconfig', '/appconfig'); //用户登录
        Route::get('addressjson', '/addressjson'); //用户登录
        Route::get('tels', '/tels'); //用户登录
        Route::get('add_goods', '/add_goods'); //用户登录
    })->prefix('Other');

    Route::group('Goods', function () {
        Route::get('banner', '/banner'); //用户登录
        Route::get('cate', '/cate'); //用户登录
        Route::get('categoods', '/categoods'); //用户登录
        Route::get('goodsdetail', '/goodsdetail'); //用户登录
        Route::post('add_order', '/add_order'); //用户登录
        Route::get('order', '/order'); //用户登录
        Route::get('orderdetail', '/orderdetail'); //用户登录
        Route::get('cacelconfirm', '/cacelconfirm'); //用户登录
    })->prefix('Goods');

    Route::group('Rider', function () {
        Route::post('Login', '/Login'); //用户登录
        Route::get('Orderlist', '/Orderlist'); //用户登录
        Route::get('orderdetail', '/orderdetail'); //用户登录
        Route::get('orders', '/orders'); //用户登录
        Route::rule('riderstreet', '/riderstreet'); //用户登录
        Route::post('setmobile', '/setmobile'); //用户登录
        Route::post('setpassword', '/setpassword'); //用户登录
        Route::post('order_cat', '/order_cat'); //用户登录
        Route::post('orderlog_del', '/orderlog_del'); //用户登录
        Route::rule('message', '/message'); //用户登录
        Route::get('serrider', '/serrider'); //用户登录
        Route::post('returnorder', '/returnorder'); //用户登录
        Route::post('confirmorder', '/confirmorder'); //用户登录
        Route::get('rank', '/rank'); //用户登录
        Route::get('getstatus', '/getstatus'); //用户登录
        Route::get('getinfo', '/getinfo'); //用户登录
        Route::get('orderuplon', '/orderuplon'); //用户登录
        Route::rule('getOpenId', '/getOpenId');
    })->prefix('Rider');

    //城市圈
    Route::group('Circle', function () {
        Route::get('Second_type', '/Second_type'); //二手交易类型
        Route::get('Second_list', '/Second_list'); //二手交易列表
        Route::get('Second_detail', '/Second_detail'); //二手交易详情
        Route::post('Second_del', '/Second_del'); //二手交易详情
        Route::rule('favorites', '/favorites'); //通用收藏
        Route::rule('leave_message', '/leave_message'); //通用留言
        Route::rule('likes', '/likes'); //通用收藏
        Route::get('circle', '/circle'); //论坛列表
        Route::get('circle_detail', '/circle_detail'); //通用收藏
        Route::rule('mycircle', '/mycircle'); //通用收藏
        Route::rule('carlist', '/carlist'); //通用收藏
        Route::rule('cputorder', '/cputorder'); //通用收藏
        Route::get('corder', '/corder'); //通用收藏
        Route::get('cdetail', '/cdetail'); //通用收藏
        Route::post('corder_true', '/corder_true'); //通用收藏
    })->prefix('Circle');
    //城市圈
    Route::group('Driver', function () {
        Route::post('login', '/login'); //二手交易类型
        Route::post('register', '/register'); //二手交易类型
        Route::rule('infos', '/infos'); //二手交易类型
        Route::rule('streets', '/streets'); //二手交易类型
        Route::rule('getproduct', '/getproduct'); //二手交易类型
        Route::get('info', '/info'); //二手交易类型
        Route::get('orderlist', '/orderlist'); //二手交易类型
        Route::get('cdetail', '/cdetail'); //二手交易类型
        Route::post('putorder', '/putorder'); //二手交易类型
    })->prefix('Driver');
})->bind('api')->prefix('api');